<?php

namespace app\admin\model;

use think\Model;

class Ads extends Model
{
    protected $autoWriteTimestamp = true; // 自动时间戳,字段为 create_time, upate_time

    /**
     * 标题搜索
     * @param  [type] $query [description]
     * @param  [type] $value [description]
     * @param  [type] $data  [description]
     * @return [type]        [description]
     */
    public function searchTitleAttr($query, $value='', $data)
    {
        if ($value) {
            $query->whereRaw("title like :title", ['title' => $value]);
        }
    }
}
